#ifndef __P25Q80L_H
	#define __P25Q80L_H			    
#include "nuclei.h"  	
 

#define P25Q80L_ID	0X8513

   

#define	P25Q80L_CS 		 		//P25Q80 CS
#define	P25Q80L_CS_ON    QSPI_REG(SPI_REG_CSID)=0x1;
#define	P25Q80L_CS_OFF   QSPI_REG(SPI_REG_CSID)=0x0;

/***************************** COMMANDS **********************************/
// P25Q80L 
#define P25Q80L_REMS    		    0x90  // Read Manufacture ID
#define P25Q80L_WriteEnable		    0x06 
#define P25Q80L_WriteDisable		0x04 
#define P25Q80L_ReadStatusReg		0x05 
#define P25Q80L_WriteStatusReg  	0x01 
#define P25Q80L_WriteStatusReg2 	0x31 
#define P25Q80L_ReadData			0x03 
#define P25Q80L_FastReadData		0x0B 
#define P25Q80L_FastReadDual		0x3B 
#define P25Q80L_PageProgram	    	0x02 
#define P25Q80L_BlockErase	    	0xD8 
#define P25Q80L_SectorErase		    0x20 
#define P25Q80L_ChipErase			0xC7 
#define P25Q80L_ReleasePowerDown	0xAB 
#define P25Q80L_DeviceID			0xAB 
#define P25Q80L_ManufactDeviceID	0x90 
#define P25Q80L_JedecDeviceID		0x9F 
#define Quad_Page_Program 	    	0x32
#define Fast_Read_Quad 		        0xEB
#define P25Q80L_ReadStatusReg2  	0x35
#define DUMMY                       0x00	// dummy clock, command can be any value.


void P25Q80L_Init(void);
uint16_t  P25Q80L_SReadID(void);  	    		//read FLASH ID
uint16_t  P25Q80L_QReadID(void);  	    		//read FLASH ID
uint8_t	 P25Q80L_ReadSR(void);        		    //Write Status register
void P25Q80L_Write_SR(uint8_t val);  			//Write Status register
void P25Q80L_Write_SR2(uint8_t val);  			//Write Status register
void P25Q80L_Write_Enable(void);  		//Write Enable  
void P25Q80L_Write_Disable(void);		//Write Disable 
void P25Q80L_Write_NoCheck(uint8_t* pBuffer,uint32_t WriteAddr,uint16_t NumByteToWrite);
void P25Q80L_Read(uint8_t* pBuffer,uint32_t ReadAddr,uint16_t NumByteToRead);       //read flash
void P25Q80L_DualRead(uint8_t* pBuffer,uint32_t ReadAddr,uint16_t NumByteToRead);   //read flash
void P25Q80L_QuadRead(uint8_t* pBuffer,uint32_t ReadAddr,uint16_t NumByteToRead);   //read flash
void P25Q80L_Write(uint8_t* pBuffer,uint32_t WriteAddr,uint16_t NumByteToWrite);    //write flash
void P25Q80L_Erase_Chip(void);    	  	//chip erase 
void P25Q80L_Erase_Sector(uint32_t Dst_Addr);	//sector erase 
void P25Q80L_Wait_Busy(void);           	//
void P25Q80L_Wait_WEL(void) ;
void Enable_QE(void);
void qspi_switch_2line(void);
void qspi_switch_4line(void);
void P25Q80L_PowerDown(void);         
void P25Q80L_WAKEUP(void);			 

#endif
















